﻿using Domain.Entitys.Sinv;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EFCore.EntityConfigurations.Sinv
{
    public class Sinv_Sale_Order_DetailsConfiguration : IEntityTypeConfiguration<Sinv_Sale_Order>
    {
        public void Configure(EntityTypeBuilder<Sinv_Sale_Order> builder)
        {
            //设置表名和主键
            builder.ToTable("sinv_sale_order");
            builder.HasKey(so => so.Sale_order_id);

            builder.HasMany(so => so.Details)
                .WithOne(so => so.Main)
                .HasForeignKey(so => so.Sale_order_id);
        }
    }
}
